package edu.scu.trainingplatform.protocol;

import java.util.Arrays;

public enum ResponseEnum {
  SUCCESS(0, "Success")
  ;

  public final String msg;
  public final int code;
  ResponseEnum(int code, String msg) {
    this.code = code;
    this.msg = msg;
  }
  public static ResponseEnum fromValue(int code) {
    for (ResponseEnum field : values()) {
      if (field.code == code) {
        return field;
      }
    }
    throw new IllegalArgumentException(String.format("Unsupported value [%s]. Expecting one of %s.", code, Arrays.toString(values())));
  }
}
